<?php
import('Html','','');
class Index_Action extends Action{
	public function index(){
		$p = $_GET['p'];
		$p1 = base64_decode( strstr($p,'/',true)).strstr($p,'/');
		$url =  parse_url($p1);
		$host = $url['host'];
		$path =  base64_encode($url['scheme'].'://'.$url['host']).dirname($url['path']).base64_encode($url['query']);
		$url = '/img/'. $path;
		$url = $url.'/'.basename($p1);
		$path = dingwork_path .'/img/'. $path;
		if(!file_exists($path)) dir_create($path);
		$file = $path.'/'.basename($p1);
		if(strpos($host,'mop.com') !== false)
			$host ='www.mop.com';
		if(!file_exists($file)) downloadfile($p1,$path,basename($p1),$host);
		header("location:$url");
	}
}

?>